package Servidor.Modelo.Users;



import java.util.ArrayList;
import java.util.Iterator;

/**
 * @author Angel Lopez
 */
public class UserList {

    private static UserList instancia = new UserList();

    private ArrayList<User> list_users = new ArrayList<User>();
    
    private UserList(){

    }
    
    /**
     * @return instancia
     */
    public static UserList getInstance(){
        return instancia;
    }
    

    public void add_user(User user){
        list_users.add(user);
        
    }
    
    public User get_user(int id_user){
        Iterator<User> iter = list_users.iterator();
        while(iter.hasNext()){
            User user = iter.next();
            if (user.getId_user() == id_user)
                return user;
        }
        return null;
    }
}
